Namespace - LJCDBClientLib
Parameters
keyColumns - The record containing the key field values.
propertyNames - The incuded column property names.
filters - The filter values.
joins - The join values.
Returns
The result object.
Syntax
C# |
public DbResult Load(DbColumns keyColumns = null, List<String> propertyNames = null, DbFilters filters = null, DbJoins joins = null)
|
Retrieves a collection of data records.
(DE)
Remarks
Parameters
keyColumns
This parameter defines the values to be used in the SQL where clause. It
is only used if the 'filters' parameter is null.
The values are separated with the 'AND' operator.
propertyNames
This parameter defines the primary table columns that are to be included
in the request. If it is null, then all the primary table columns are
included.
It must not include Calculated or Join columns or it will cause an error.
filters
This parameter defines the values to be used in the SQL where clause. If
it is defined, then the keyColumns parameter is not used.
The 'filters' object can define a complex where clause including
combinations of 'AND' and 'OR' operators.
joins
The 'joins' parameter defines the join tables, join on values and join
column definitions.
Creates a "Load"
DbRequest
object, which is available in the Request property. The request object is
passed to the
ExecuteRequest()
method.
Request Column property names and values are added to the Result Value columns.
The Result Data Object property names must match the Result Value Column
property names to map the values into the Result Data Object.
Result Data Object property names that are different from the Request Column
names can be handled by setting the Request Column Property name. The
MapNames() method is a helper method for setting the Property name.
Method Graph
All methods are in LJCDBMessage.DbCommon.
RequestColumns(baseDefinition)
RequestKeys(keyColumns)
CreateKeyColumn(keyColumn)
Example
C# |
using LJCNetCommon;
using LJCDBMessage;
public class PersonManager
{
keyObject
propertyNames
filters
dbJoins
public Persons Load(Person keyObject = null, List<string> propertyNames = null
, DbFilters filters = null, DbJoins dbJoins = null)
{
Persons retValue = null;
DbResult dbResult = mDataManager.Load(keyObject, propertyNames, filters, dbJoins);
SQLStatement = mDataManager.SQLStatement;
if (dbResult != null && dbResult.DbRecords.Count > 0)
{
retValue = CreateCollection(dbResult);
}
return retValue;
}
dbResult
private Persons CreateCollection(DbResult dbResult)
{
Persons retValue = new Persons();
foreach (DbColumns dbColumns in dbResult.DbRecords)
{
Person person = new Person();
DbCommon.SetObjectValues(dbColumns, person);
retValue.Add(person);
}
return retValue;
}
}
|
Copyright © Lester J. Clark and Contributors.
Licensed under the MIT License.